package com.qtcm.nas.spc.xiaoshou.web;

import com.qtcm.nas.spc.pojo.Commodity_Out;
import com.qtcm.nas.spc.pojo.XiangQIng;
import com.qtcm.nas.spc.xiaoshou.service.ImpXiaoShou_Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @Description说明: TODO
 * @Date 2022/7/16 9:04
 * @PackageName:com.jzyh.spc.login.service
 * @ClassName: ImpUserService
 * @Author作者: Spc
 * @Version 1.0
 * @自己写的注释:
 */
@Controller("xiaoShou_Controller")
@RequestMapping("/xiaoshou")
public class XiaoShou_Controller {
    @Autowired
    @Qualifier("xiaoShou_Service")
    private ImpXiaoShou_Service xiaoShou_Service;

    @RequestMapping("/shou1")
    public String method(Model model,String start,String end) {
        model.addAttribute("start",start);
        model.addAttribute("end",end);
        int Wx = 0;
        int Xj = 0;
        int Sk = 0;
        int Yz = 0;
//        现金
        List<Integer> listXj = xiaoShou_Service.findXianJ(start,end);
        for (Integer i : listXj
        ) {
            Xj += i;
        }
//        微信
        List<Integer> listWx = xiaoShou_Service.findWeiX(start,end);
        for (Integer i : listWx) {
            Wx += i;
        }
//        刷卡
        List<Integer> listSk = xiaoShou_Service.findShuaK(start,end);
        for (Integer i : listSk) {
            Sk += i;
        }
//        邮政
        List<Integer> listYz = xiaoShou_Service.findYouZ(start,end);
        for (Integer i : listYz) {
            Yz += i;
        }
//        财务报表
        model.addAttribute("wx", Wx);
        model.addAttribute("xj", Xj);
        model.addAttribute("sk", Sk);
        model.addAttribute("yz", Yz);
//        商品销售报表
        int XlZongE = 0;
        List<Commodity_Out> listSpXs = xiaoShou_Service.findXiao();
        model.addAttribute("XiaoLiang", listSpXs);
//         商品库存
        List<Commodity_Out> listKucun = xiaoShou_Service.findKucun();
        model.addAttribute("kucun", listKucun);
//        已洗车辆
        int yxcl = xiaoShou_Service.findYxc(start,end);
        model.addAttribute("yxcl", yxcl);
//        非会员消费
        int nhysr = 0;
        List<Integer> listNoHuiys = xiaoShou_Service.findFeiHuiY(start,end);
        for (Integer i : listNoHuiys) {
            nhysr += i;
        }
        model.addAttribute("nhysr", nhysr);
//        会员收入
        int hysr = 0;
        List<Integer> listHuiY = xiaoShou_Service.findHuiy(start,end);
        for (Integer i : listNoHuiys) {
            hysr += i;
        }
        model.addAttribute("hysr", hysr);
//        储值卡收入
        int czksr = 0;
        List<Integer> listChuZk = xiaoShou_Service.findChuZk(start,end);
        for (Integer i : listChuZk) {
            czksr += i;
        }
        model.addAttribute("czksr", czksr);
//        年卡收入
        int nksr = 0;
        List<Integer> listNiank = xiaoShou_Service.findNianK(start,end);
        for (Integer i : listNiank) {
            nksr += i;
        }
        model.addAttribute("nksr", nksr);
//
        return "sale_Search";
    }

    //    现金支付详情
    @RequestMapping("/xianjin")
    public String findXianJ(Model model,String start,String end) {
        List<XiangQIng> listXiangQ = xiaoShou_Service.findXjXQ(start,end);
        model.addAttribute("xjxq", listXiangQ);
        return "report_Nocard";
    }

    //    业绩报表非会员收入详情
    @RequestMapping("/yeji")
    public String findNoHuiY(Model model,String start,String end) {
        List<XiangQIng> listYejXq = xiaoShou_Service.findYejiNoHuiY(start,end);
        model.addAttribute("listYejXq", listYejXq);
        return "report_Card";
    }
}
